3.221 \(\int \tan (c+d x) (a+i a \tan (c+d x))^n (A+B \tan (c+d x)) \, dx\)

Optimal. Leaf size=111 \[ -\frac {(A-i B) (a+i a \tan (c+d x))^n \, _2F_1\left (1,n;n+1;\frac {1}{2} (i \tan (c+d x)+1)\right )}{2 d n}+\frac {A (a+i a \tan (c+d x))^n}{d n}-\frac {i B (a+i a \tan (c+d x))^{n+1}}{a d (n+1)} \]

[Out]

A*(a+I*a*tan(d*x+c))^n/d/n-1/2*(A-I*B)*hypergeom([1, n],[1+n],1/2+1/2*I*tan(d*x+c))*(a+I*a*tan(d*x+c))^n/d/n-I
*B*(a+I*a*tan(d*x+c))^(1+n)/a/d/(1+n)

________________________________________________________________________________________

Rubi [A]  time = 0.12, antiderivative size = 111, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 32, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {3592, 3527, 3481, 68} \[ -\frac {(A-i B) (a+i a \tan (c+d x))^n \, _2F_1\left (1,n;n+1;\frac {1}{2} (i \tan (c+d x)+1)\right )}{2 d n}+\frac {A (a+i a \tan (c+d x))^n}{d n}-\frac {i B (a+i a \tan (c+d x))^{n+1}}{a d (n+1)} \]

Antiderivative was successfully verified.

[In]

Int[Tan[c + d*x]*(a + I*a*Tan[c + d*x])^n*(A + B*Tan[c + d*x]),x]

[Out]

(A*(a + I*a*Tan[c + d*x])^n)/(d*n) - ((A - I*B)*Hypergeometric2F1[1, n, 1 + n, (1 + I*Tan[c + d*x])/2]*(a + I*
a*Tan[c + d*x])^n)/(2*d*n) - (I*B*(a + I*a*Tan[c + d*x])^(1 + n))/(a*d*(1 + n))

Rule 68

Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[((b*c - a*d)^n*(a + b*x)^(m + 1)*Hype
rgeometric2F1[-n, m + 1, m + 2, -((d*(a + b*x))/(b*c - a*d))])/(b^(n + 1)*(m + 1)), x] /; FreeQ[{a, b, c, d, m
}, x] && NeQ[b*c - a*d, 0] &&  !IntegerQ[m] && IntegerQ[n]

Rule 3481

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> -Dist[b/d, Subst[Int[(a + x)^(n - 1)/(a - x), x]
, x, b*Tan[c + d*x]], x] /; FreeQ[{a, b, c, d, n}, x] && EqQ[a^2 + b^2, 0]

Rule 3527

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(d*
(a + b*Tan[e + f*x])^m)/(f*m), x] + Dist[(b*c + a*d)/b, Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[{a, b, c,
d, e, f, m}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] &&  !LtQ[m, 0]

Rule 3592

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(
e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(B*d*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)), x] + Int[(a + b*Tan[e
 + f*x])^m*Simp[A*c - B*d + (B*c + A*d)*Tan[e + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, m}, x] && NeQ[b
*c - a*d, 0] &&  !LeQ[m, -1]

Rubi steps

\begin {align*} \int \tan (c+d x) (a+i a \tan (c+d x))^n (A+B \tan (c+d x)) \, dx &=-\frac {i B (a+i a \tan (c+d x))^{1+n}}{a d (1+n)}+\int (a+i a \tan (c+d x))^n (-B+A \tan (c+d x)) \, dx\\ &=\frac {A (a+i a \tan (c+d x))^n}{d n}-\frac {i B (a+i a \tan (c+d x))^{1+n}}{a d (1+n)}-(i A+B) \int (a+i a \tan (c+d x))^n \, dx\\ &=\frac {A (a+i a \tan (c+d x))^n}{d n}-\frac {i B (a+i a \tan (c+d x))^{1+n}}{a d (1+n)}-\frac {(a (A-i B)) \operatorname {Subst}\left (\int \frac {(a+x)^{-1+n}}{a-x} \, dx,x,i a \tan (c+d x)\right )}{d}\\ &=\frac {A (a+i a \tan (c+d x))^n}{d n}-\frac {(A-i B) \, _2F_1\left (1,n;1+n;\frac {1}{2} (1+i \tan (c+d x))\right ) (a+i a \tan (c+d x))^n}{2 d n}-\frac {i B (a+i a \tan (c+d x))^{1+n}}{a d (1+n)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B]  time = 32.52, size = 270, normalized size = 2.43 \[ 2^{n-1} e^{-2 i d n x} \left (e^{i d x}\right )^n \left (\frac {e^{i (c+d x)}}{1+e^{2 i (c+d x)}}\right )^n \sec ^{-n}(c+d x) (\cos (d x)+i \sin (d x))^{-n} (a+i a \tan (c+d x))^n \left (\frac {(A+i B) e^{2 i d n x} \left (1+e^{2 i (c+d x)}\right )^n \, _2F_1\left (n,n+2;n+1;-e^{2 i (c+d x)}\right )}{d n}+\frac {e^{2 i c} \left (-\frac {(A-i B) e^{2 i (c+d (n+2) x)} \left (1+e^{2 i (c+d x)}\right )^n \, _2F_1\left (n+2,n+2;n+3;-e^{2 i (c+d x)}\right )}{n+2}-\frac {2 i B e^{2 i d (n+1) x}}{(n+1) \left (1+e^{2 i (c+d x)}\right )}\right )}{d}\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[Tan[c + d*x]*(a + I*a*Tan[c + d*x])^n*(A + B*Tan[c + d*x]),x]

[Out]

(2^(-1 + n)*(E^(I*d*x))^n*(E^(I*(c + d*x))/(1 + E^((2*I)*(c + d*x))))^n*(((A + I*B)*E^((2*I)*d*n*x)*(1 + E^((2
*I)*(c + d*x)))^n*Hypergeometric2F1[n, 2 + n, 1 + n, -E^((2*I)*(c + d*x))])/(d*n) + (E^((2*I)*c)*(((-2*I)*B*E^
((2*I)*d*(1 + n)*x))/((1 + E^((2*I)*(c + d*x)))*(1 + n)) - ((A - I*B)*E^((2*I)*(c + d*(2 + n)*x))*(1 + E^((2*I
)*(c + d*x)))^n*Hypergeometric2F1[2 + n, 2 + n, 3 + n, -E^((2*I)*(c + d*x))])/(2 + n)))/d)*(a + I*a*Tan[c + d*
x])^n)/(E^((2*I)*d*n*x)*Sec[c + d*x]^n*(Cos[d*x] + I*Sin[d*x])^n)

________________________________________________________________________________________

fricas [F]  time = 0.58, size = 0, normalized size = 0.00 \[ {\rm integral}\left (\frac {{\left ({\left (-i \, A - B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, B e^{\left (2 i \, d x + 2 i \, c\right )} + i \, A - B\right )} \left (\frac {2 \, a e^{\left (2 i \, d x + 2 i \, c\right )}}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}\right )^{n}}{e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, e^{\left (2 i \, d x + 2 i \, c\right )} + 1}, x\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))^n*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

integral(((-I*A - B)*e^(4*I*d*x + 4*I*c) + 2*B*e^(2*I*d*x + 2*I*c) + I*A - B)*(2*a*e^(2*I*d*x + 2*I*c)/(e^(2*I
*d*x + 2*I*c) + 1))^n/(e^(4*I*d*x + 4*I*c) + 2*e^(2*I*d*x + 2*I*c) + 1), x)

________________________________________________________________________________________

giac [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (B \tan \left (d x + c\right ) + A\right )} {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{n} \tan \left (d x + c\right )\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))^n*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

integrate((B*tan(d*x + c) + A)*(I*a*tan(d*x + c) + a)^n*tan(d*x + c), x)

________________________________________________________________________________________

maple [F]  time = 4.97, size = 0, normalized size = 0.00 \[ \int \tan \left (d x +c \right ) \left (a +i a \tan \left (d x +c \right )\right )^{n} \left (A +B \tan \left (d x +c \right )\right )\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(d*x+c)*(a+I*a*tan(d*x+c))^n*(A+B*tan(d*x+c)),x)

[Out]

int(tan(d*x+c)*(a+I*a*tan(d*x+c))^n*(A+B*tan(d*x+c)),x)

________________________________________________________________________________________

maxima [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int {\left (B \tan \left (d x + c\right ) + A\right )} {\left (i \, a \tan \left (d x + c\right ) + a\right )}^{n} \tan \left (d x + c\right )\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))^n*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

integrate((B*tan(d*x + c) + A)*(I*a*tan(d*x + c) + a)^n*tan(d*x + c), x)

________________________________________________________________________________________

mupad [F]  time = 0.00, size = -1, normalized size = -0.01 \[ \int \mathrm {tan}\left (c+d\,x\right )\,\left (A+B\,\mathrm {tan}\left (c+d\,x\right )\right )\,{\left (a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}\right )}^n \,d x \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(c + d*x)*(A + B*tan(c + d*x))*(a + a*tan(c + d*x)*1i)^n,x)

[Out]

int(tan(c + d*x)*(A + B*tan(c + d*x))*(a + a*tan(c + d*x)*1i)^n, x)

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (i a \left (\tan {\left (c + d x \right )} - i\right )\right )^{n} \left (A + B \tan {\left (c + d x \right )}\right ) \tan {\left (c + d x \right )}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))**n*(A+B*tan(d*x+c)),x)

[Out]

Integral((I*a*(tan(c + d*x) - I))**n*(A + B*tan(c + d*x))*tan(c + d*x), x)

________________________________________________________________________________________